package com.dailyblue.project.estate.config;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.InMemoryChatMemory;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther:Liu
 * @Testname:ChartClientConfi
 * @Date:2025/9/22 10:28
 */
@Configuration
public class ChartClientConfig {
    @Resource
    private OllamaChatModel ollamaChatModel;
//    @Resource
    private ChatMemory chatMemory;

    @Bean(name = "ollamaChatClient")
    public ChatClient ClientConfig() {
        return ChatClient
                .builder(ollamaChatModel)
                .defaultSystem("你是张三，来自于宝鸡文理学院。请以大学生的幽默欢快的语气说话")
                .defaultAdvisors(new MessageChatMemoryAdvisor(new InMemoryChatMemory()))
                .build();
    }
}
